package com.tlscpro.zwt.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloController {
    @RequestMapping("/")
    public String hello(){
        return "index";
    }

    @RequestMapping("/ajaxTest")
    @ResponseBody
    public String ajaxTest(@RequestParam String typeName, @RequestParam int type) {
        switch (typeName) {
            case "javaScript":
                if (type == 1) {
                    return "welcome javaScript";
                }
            case "jQuery":
                if (type == 2) {
                    return "welcome jQuery";
                }
            case "fetch":
                if (type == 3) {
                    return "welcome fetch";
                }
            case "axios":
                if (type == 4) {
                    return "welcome axios";
                }
            default:
                return "welcome";
        }
    }
}
